﻿using MediatR;
using S.RBAC.Domain.Model;
using S.RBAC.Infrastructure.Interface;
using S.RBAC.Read.Api.Application.Command.RoleCommand;

namespace S.RBAC.Read.Api.Application.CommandHandlers.RoleHandler
{
    public class RoleGetAllCommandHandler : IRequestHandler<RoleGetAllCommand, List<Role>>
    {
        protected readonly IRoleRepository _role;

        public RoleGetAllCommandHandler(IRoleRepository role)
        {
            _role = role;
        }

        public async Task<List<Role>> Handle(RoleGetAllCommand request, CancellationToken cancellationToken)
        {
            var info = await _role.GetAllRole();

            return info;
        }
    }
}
